<?php

namespace app\index\controller;

use app\index\controller\CommonController;
use app\index\model\Enterprise;
use app\index\model\Meiti;
use app\index\model\Trend;

/*
 * 关于我们
 */
class EnterpriseController extends CommonController
{
    /*
     * 关于我们
     */
    public function about()
    {
        $row = Enterprise::where('id', '=', Enterprise::ID_1)
            ->find();

        return view('about', [
            'menuIndex' => 7,
            'aboutIndex' => 1,
            'row' => $row,
        ]);
    }

    /*
     * 联系我们
     */
    public function contact()
    {
        $row = Enterprise::where('id', '=', Enterprise::ID_2)
            ->find();

        return view('contact', [
            'menuIndex' => 7,
            'aboutIndex' => 4,
            'row' => $row,
        ]);
    }

    /*
     * 商务合作
     */
    public function cooperate()
    {
        $row = Enterprise::where('id', '=', Enterprise::ID_3)
            ->find();

        return view('cooperate', [
            'menuIndex' => 7,
            'aboutIndex' => 5,
            'row' => $row,
        ]);
    }

    /*
     * 加入我们
     */
    public function joinus()
    {
        $row = Enterprise::where('id', '=', Enterprise::ID_4)
            ->find();

        return view('joinus', [
            'menuIndex' => 7,
            'aboutIndex' => 6,
            'row' => $row,
        ]);
    }

    /*
     * 免责声明
     */
    public function statement()
    {
        $row = Enterprise::where('id', '=', Enterprise::ID_5)
            ->find();

        return view('statement', [
            'menuIndex' => 7,
            'aboutIndex' => 7,
            'row' => $row,
        ]);
    }

    /*
     * 建议与投诉
     */
    public function suggest()
    {
        $row = Enterprise::where('id', '=', Enterprise::ID_6)
            ->find();

        return view('suggest', [
            'menuIndex' => 7,
            'aboutIndex' => 8,
            'row' => $row,
        ]);
    }

    /*
     * 企业动态
     */
    public function trend()
    {
        $trendList = Trend::order('add_time desc')
            ->paginate(5);

        return view('trend', [
            'menuIndex' => 7,
            'aboutIndex' => 2,
            'trendList' => $trendList,
        ]);
    }

    /*
     * 企业动态详情
     */
    public function trendCnt()
    {
        $id = input('param.id');

        $row = Trend::where('id', '=', $id)->find();

        $preRow = Trend::where('id', '<', $id)
            ->order('add_time desc')
            ->find();

        return view('trendcnt', [
            'menuIndex' => 7,
            'aboutIndex' => 3,
            'row' => $row,
            'preRow' => $preRow,
        ]);
    }

    /*
     * 媒体报道
     */
    public function meiti()
    {
        $meitiList = Meiti::order('add_time desc')
            ->paginate(10);

        return view('meiti', [
            'menuIndex' => 7,
            'aboutIndex' => 3,
            'meitiList' => $meitiList,
        ]);
    }


}